<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="demo">
    性：<input type="text" placeholder="FirstName"><br>
    名：<input type="text" placeholder="LastName"><br>
    姓名1(单向): <input type="text" placeholder="Full Name"><br>
    姓名2(单向): <input type="text" placeholder="Full Name2"><br>
    姓名3(双向): <input type="text" placeholder="Full Name3"><br>
  </div>
  <script type="text/javascript" src="../js/vue.js"></script>
  <script>
    // new Vue({

    // })
    const p={
      firstName:'A',
      lastName:'B'
    }
    Object.defineProperty(p,"fullName",{
      get(){
        console.log('get()')
       return this.firstName+'-'+this.lastName
      },
      set(value){
        console.log('set()',value)
       const names=value.split('-');
       this.firstName=names[0]
       this.lastName=names[1]
      }
    })
    p.firstName='c'
    p.lastName='d'
    console.log(p.fullName)
    p.fullName='E-F'
    console.log(p)
    console.log(p.firstName,p.lastName);
  </script>
</body>
</html>